package month4.day19;

import java.util.Objects;

public class Staff {
    private String name;
    private int age;
    private String sex;
    private String duty;
    private int money;
    private String number;

//    @Override
//    public boolean equals(Object o) {
//        if(o instanceof Staff){
//            Staff s=(Staff) o;
//            if(this.number==null){
//                if(s.getNumber()==null)
//                    return true;
//            }else {
//                return this.number.equals((s.getNumber()));
//            }
//        }
//        return false;
//    }
//
//
//    @Override
//    public int hashCode() {
//        return number==null?0:number.hashCode();
//    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Staff staff = (Staff) o;
        return number.equals(staff.number);
    }

    @Override
    public int hashCode() {
        return Objects.hash(number);
    }

    public void show(){
        System.out.println("员工姓名："+name+"，年龄："+age+"，性别："+sex+"，职务："+duty+"，薪水："+money+"，工号："+number);
    }

    public Staff() {
    }

    public Staff(String name, int age, String sex, String duty, int money, String number) {
        this.name = name;
        this.age = age;
        this.sex = sex;
        this.duty = duty;
        this.money = money;
        this.number = number;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    public String getDuty() {
        return duty;
    }

    public void setDuty(String duty) {
        this.duty = duty;
    }

    public int getMoney() {
        return money;
    }

    public void setMoney(int money) {
        this.money = money;
    }

    public String getNumber() {
        return number;
    }

    public void setNumber(String number) {
        this.number = number;
    }
}
